﻿@model Int32
@{
    int currentactivity=Model;

    if (currentactivity == -1){
        currentactivity = int.Parse(System.Configuration.ConfigurationManager.AppSettings["CurrentActivityID"]);
    }
    
    var isExpertGroupLeader = false;
    PessModel.PESSEntities db = new PessModel.PESSEntities();
    var currentUser=Membership.GetUser();
    if(currentUser!=null)
    {
        if(db.ExpertGroups.Where(g => g.LeaderID == currentUser.UserName).Count()>0)
        {
            isExpertGroupLeader = true;
        }
    }

    bool hideArchiveDetails = false;
    var activity = db.Activities.Find(currentactivity);

    if(activity!=null)
    {
        if(activity.HideArchiveDetails!=null)
        {
        hideArchiveDetails = (bool)activity.HideArchiveDetails;
        }
        else
        {
            hideArchiveDetails = false;
        }
    }
}
@if (currentactivity >= 0)
{
    <link href="@Url.Content("~/content/subnav.css")" rel="stylesheet" type="text/css"/>

    <ul>

        @if (Membership.GetUser() != null && (Roles.IsUserInRole(Membership.GetUser().UserName, "Admin")||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "Chair") ||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "Editor"))) 
            { 
                <li>@Html.MenuLink("Event Home", "Details", "Activity", new { id = currentactivity }) </li>
            }
        
        
            @if (Membership.GetUser() != null && Roles.IsUserInRole(Membership.GetUser().UserName, "Author"))
            {
                <li>@Html.MenuLink("My Account", "Index", "Author",null) </li>
            }
   
            <li>@Html.MenuLink("Registration", "Register", "Registrations",null)</li>
        @*<li>@if(Membership.GetUser()!=null&&Roles.IsUserInRole(Membership.GetUser().UserName,"Admin"))
            {
                @Html.MenuLink("Quota","Quota","CandidateQuota",new {ActivityID=Model});
            }
        </li>*@
        @if (Membership.GetUser() != null && (Roles.IsUserInRole(Membership.GetUser().UserName, "Admin")||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "Chair")||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "ExpertJudge") ||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "Editor")
                                                  ))
            {
                <li>@Html.MenuLink("Review Proposals", "Index", "Archive", new { ActivityID = currentactivity })</li>
            }

        @if (Membership.GetUser() != null && (Roles.IsUserInRole(Membership.GetUser().UserName, "Admin")||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "Chair")||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "ExpertJudge") ||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "Editor")
                                                  ))
            {
                <li>@Html.MenuLink("Review Papers", "PaperIndex", "Archive", new { ActivityID = currentactivity })</li>
            }
        @if (Membership.GetUser() != null && (Roles.IsUserInRole(Membership.GetUser().UserName, "Admin") ||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "Chair")))
            {
                <li>@Html.MenuLink("Reviewer Group", "Index", "ExpertGroup", new { ActivityID = currentactivity })</li>
            }
        
        @if (Membership.GetUser() != null && (Roles.IsUserInRole(Membership.GetUser().UserName, "Admin") ||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "Chair")))//|| Roles.IsUserInRole(Membership.GetUser().UserName, "ExpertJudge")))
            {
                //if(!hideArchiveDetails)
                //{
                    <li>@Html.MenuLink("Review Rubric","Index","Rule",new {ActivityID=currentactivity})</li>
                //}
            }
        
        
            @if (Membership.GetUser() != null && (Roles.IsUserInRole(Membership.GetUser().UserName, "Admin") ||
                                                  Roles.IsUserInRole(Membership.GetUser().UserName, "ExpertJudge")
                                                  &&isExpertGroupLeader))
            {
                @*<li>@Html.MenuLink("Report","ScoreReport","Report",new {ActivityID=currentactivity})</li>*@
                <li>@Html.MenuLink("Registrations", "Index", "Registrations", new { ActivityID = currentactivity })</li>
                <li>@Html.MenuLink("System Log", "Index", "SysLogs", new { ActivityID = currentactivity })</li>
            }
        
        <li class="subTitle" style="display:none">@activity.Name</li>
    </ul>
}